window.onload=function(){
    var swiper = new Swiper('.swiper-container', {
        pagination: {
          el: '.swiper-pagination',
          clickable: true,
          renderBullet: function (index, className) {
            return '<span class="' + className + '">'  + '</span>';
            
          },
        },
      });

      var  oDiv=document.getElementById('box');
      var oA=oDiv.getElementsByTagName('a');
      var oCen=document.getElementById('cnter');
      var oHome=document.getElementById('home');
      var oCentont=document.getElementById('content');
      var oHh=oCentont.getElementsByClassName('home');
     
      for (var i = 0; i < oA.length; i++) {
        oA[i].index = i;
        oA[i].onclick = function() {
          for(var i = 0; i < oA.length; i++) {
            oA[i].className = "";
            oHh[i].style.display='none';
          }
          this.className = "active";
          oHh[this.index].style.display='block';
         
        };   
      }
      window.onscroll=function(){
        var  oTt=document.getElementById('tt');
        var scrolltop = document.documentElement.scrollTop || document.body.scrollTop; //滚轮事件

        if(scrolltop >= 600){
          oTt.style.position='fixed';
          oTt.style.top='0';
        }else{
          oTt.style.position='';
        }
      };

    
      //复选框的切换；
      var oLists=document.getElementById('case-lists');

      var oAlist=oLists.getElementsByTagName('a');
      var oImg=document.getElementById('imgs');
      var oImgs=document.getElementsByClassName('case-sort');



      // 二级导航栏的切换
      for (var i = 0; i < oAlist.length; i++) {
        oAlist[i].index = i;
        oAlist[i].onclick = function() {
          for(var i = 0; i < oAlist.length; i++) {
            oAlist[i].className = "";
            oImgs[i].style.display='none';
          }
          this.className = "down-one";
          oImgs[this.index].style.display='block';
        };   
      }
      // form  判断
      var oName=document.getElementById('park_name');
      var oNum=document.getElementById('car_num');
      var oCus=document.getElementById('customer_name');
      var oTel=document.getElementById('tel');
      var oEmail=document.getElementById('email');
      var oAdress=document.getElementById('address');
      var oAler=document.getElementsByClassName('aler')[0];
      var oF=document.getElementsByClassName('from')[0];
      var oBt=document.getElementsByClassName('button')[0];

      function alr(txt){
        oAler.innerHTML=txt;
        oAler.style.transform='scale(1)';
        setTimeout(function(){
          oAler.style.transform='scale(0)';
        },2000);
      }
     oBt.onclick=function(){
        if(oName==''){
          alr('车场名称不能为空');
          return false;
        }
        else if(!(/^1[34578]\d{9}$/.test(oTel.nodeValue))){
          alr('联系电话格式不对');
          return false;
        }else{
          oF.reset();
          alr('提交资料成功');
          return false;
        }
      };
      page(document.getElementById('img-ac'));
      page(document.getElementById('img-bc'));
      page(document.getElementById('img-cc'));
      // page( document.getElementsByClassName('img-two'));
      // page(this.document.getElementsByClassName('img-three'));
    function page(k){
      var  oImgA=k.getElementsByClassName('img-a')[0];
      var oImgaa=k.getElementsByClassName('one');
      var oImg=k.getElementsByClassName('img-ones');
      
      for(var i=0;i<oImgaa.length;i++){
       
        oImgaa[i].index=i;
        oImgaa[i].onclick=function(){
          for(var o=0;o<oImgaa.length;o++){
            oAlist[i].className = "";
            oImg[o].style.display='none';
          } 
          this.className = "down-one";
          oImg[this.index].style.display='block';
        };

       
      }
    }


};

      






      






